package com.renshine.swing.component.dialog;

import java.awt.BorderLayout;

import javax.annotation.Resource;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.renshine.base.util.FileUtil;
import com.renshine.base.util.StyleUtil;
import com.renshine.swing.component.panel.ButtonPanel;
import com.renshine.swing.component.panel.HelpPanel;
import com.renshine.swing.component.panel.TablePanel;

@Component
@SuppressWarnings("serial")
public class CreateJDialog extends JFrame implements InitializingBean{
	
	@Resource
	TablePanel editPanel;
	@Resource
	TablePanel searchPanel;
	@Resource
	TablePanel listPanel;
	@Resource
	TablePanel initPanel;
	@Autowired
	ButtonPanel buttonPanel;
	@Autowired
	HelpPanel helpPanel;
	
	JTabbedPane tabbedPanel;
	
	public CreateJDialog() {
		setTitle("认仕医生");
		ImageIcon logoIcon = new ImageIcon(FileUtil.getFilePath("images/logo/16x16.png")); 
		setIconImage(logoIcon.getImage());
		setAlwaysOnTop(true);
		setBounds(100, 100, 948, 474);
		StyleUtil.setWindowStyle(this);
		getContentPane().setLayout(new BorderLayout());
		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
	}
	
	@Override
	public void afterPropertiesSet() throws Exception {
		{
			getContentPane().setLayout(new BorderLayout());
			
			tabbedPanel = new JTabbedPane(JTabbedPane.TOP);
			getContentPane().add(tabbedPanel, BorderLayout.CENTER);
			tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
			tabbedPanel.addTab("请选择表", initPanel);
			tabbedPanel.addTab("信息编辑", editPanel);
			tabbedPanel.addTab("信息搜索", searchPanel);
			tabbedPanel.addTab("信息列表", listPanel);
			//tabbedPanel.addTab("关于", helpPanel);
		}
		{			
			getContentPane().add(buttonPanel, BorderLayout.SOUTH);
		}
	}

	public ButtonPanel getButtonPanel() {
		return buttonPanel;
	}

	public void setButtonPanel(ButtonPanel buttonPanel) {
		this.buttonPanel = buttonPanel;
	}

	public TablePanel getInitPanel() {
		return initPanel;
	}

	public void setInitPanel(TablePanel initPanel) {
		this.initPanel = initPanel;
	}

	public TablePanel getEditPanel() {
		return editPanel;
	}

	public void setEditPanel(TablePanel editPanel) {
		this.editPanel = editPanel;
	}

	public TablePanel getSearchPanel() {
		return searchPanel;
	}

	public void setSearchPanel(TablePanel searchPanel) {
		this.searchPanel = searchPanel;
	}

	public TablePanel getListPanel() {
		return listPanel;
	}

	public void setListPanel(TablePanel listPanel) {
		this.listPanel = listPanel;
	}

	public JTabbedPane getTabbedPanel() {
		return tabbedPanel;
	}

	public void setTabbedPanel(JTabbedPane tabbedPanel) {
		this.tabbedPanel = tabbedPanel;
	}

	

}
